package com.mall.service.impl;

import com.mall.dao.custom.CtPvMapper;
import com.mall.dao.generator.PvMapper;
import com.mall.entity.Pv;
import com.mall.service.PvService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;

/**
 * @author xyl
 * @date 2021-03-08 19:08
 */
@Service
public class PvServiceImpl implements PvService {

    @Autowired
    private CtPvMapper pvMapper;

    @Override
    public int addPv(String ip) {
        Pv pv = new Pv();
        pv.setCreateTime(new Date());
        pv.setIp(ip);
        return pvMapper.insert(pv);
    }

    @Override
    public Integer getTodayPv() {
        return pvMapper.selectTodayPv();
    }

    @Override
    public Integer getTotalPv() {
        return pvMapper.selectTotalPv();
    }
}
